package com.prime.tutorial.moviestore.view.reports;

import com.prime.tutorial.moviestore.domain.Users;
import com.prime.tutorial.moviestore.service.reports.ReportsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * Provides the view level of the activeUsersAt report.
 * @author vasylja
 */
@Component("activeUsersAt")
@Scope("request")
public class ActiveUsersAtImpl {
    private ReportsService reportsService;
    private List<Users> listActiveUsersAt;

    @Autowired
    public ActiveUsersAtImpl(ReportsService reportsService,Date start, Date end) {
        this.reportsService = reportsService;
        setListActiveUsersAt(this.reportsService.getActiveUsersAtReport(start,end));
    }

    public List<Users> getListActiveUsersAt() {
        return listActiveUsersAt;
    }

    private void setListActiveUsersAt(List<Users> listActiveUsersAt) {
        this.listActiveUsersAt = listActiveUsersAt;
    }
}
